package com.msh.automatic.android.api.controller.admin;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.msh.automatic.android.api.entity.ActivationCode;
import com.msh.automatic.android.api.entity.Device;
import com.msh.automatic.android.api.mapper.ActivationCodeMapper;
import com.msh.automatic.android.api.mapper.DeviceMapper;
import com.msh.automatic.android.api.util.JwksUtil;
import com.msh.automatic.android.api.util.RetUtil;
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.RSASSASigner;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.util.Date;

@Slf4j
@RestController("a_device")
@RequestMapping("/a/device")
public class DeviceController {

    @Resource
    JwksUtil jwksUtil;
    @Resource
    DeviceMapper deviceMapper;
    @Resource
    ActivationCodeMapper activationCodeMapper;

    @ApiOperation(value = "设备信息")
    @RequestMapping(value = "/info", method = RequestMethod.POST)
    public Object info(@RequestBody Device params) throws UnsupportedEncodingException {
        Device device = deviceMapper.selectById(params.getId());
        return RetUtil.success(device);
    }
}
